'''
Created on 2024年7月27日

@author: Administrator
'''

import plotly.express as px

from die import Die

# die = Die()

die_1 = Die()
die_2 = Die(10)

results = []

for roll_num in range(50_000):
    result = die_1.roll() + die_2.roll()
    results.append(result)
    

# print(results)

frequencies = []
max_result = die_1.num_sides + die_2.num_sides
poss_results = range(1,max_result+1)
for value in poss_results:
    frequency = results.count(value)
    frequencies.append(frequency)

print(frequencies)

# title = "Results of Rolling One D6 1,000 Times"
# title = "Results of Rolling Two D6 Dice 1,000 Times"
title = "Results of Rolling a D6 and a D10 50,000 Times"
labels = {'x':'Result','y':'Frequency of Result'}


fig = px.bar(x=poss_results,y=frequencies,title=title,labels=labels)

fig.update_layout(xaxis_dtick=1)

fig.show()

fig.write_html("dice_visual_d6d10.html")



